package com.itchu.system.mapper;


import com.itchu.system.domain.SysUser;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import com.itchu.system.common.BaseMapper;

public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("SELECT * FROM sys_user WHERE username = #{name}")
    @Results({
            @Result(id = true,property = "id", column = "id"),
            @Result(property = "roles", column = "id",javaType = java.util.List.class,
            many = @Many(select = "com.itchu.system.mapper.SysRoleMapper.findByUid"))
    })
    SysUser findByUserName(String username);
}
